package org.fkjava.oa.identity.dao.impl;

import java.util.List;

import org.fkjava.common.dao.impl.BaseDaoImpl;
import org.fkjava.common.util.pager.PageModel;
import org.fkjava.oa.identity.dao.JobDao;
import org.fkjava.oa.identity.dao.RoleDao;
import org.fkjava.oa.identity.domain.Role;

/**
 * @author xlei
 * @Email dlei0006@163.com
 * @QQ 251425887
 * @Tel 18665616520
 * @Date 2017年1月14日上午9:44:47
 * @From http://www.fkjava.org 
 *
 */
public class RoleDaoImpl extends BaseDaoImpl implements RoleDao {
	@Override
	public List<Role> selectRoleByPager(PageModel pageModel) throws Exception {
		return findByPage("select r from Role r order by r.id asc", pageModel,null);
	}

	@Override
	public void deleteRolesByIds(String[] id_s) throws Exception {
		// 查谁找谁
		StringBuilder hql = new StringBuilder();
		hql.append("delete Role r where r.id in(");
		Long[] params = new Long[id_s.length];
		for(int i = 0 ; i < id_s.length ; i++) {
			hql.append(i==id_s.length -1 ? "?)":"?,");
			params[i] = Long.parseLong(id_s[i]);
		}
		bulkUpdate(hql.toString(), params);
	}
	
}







